<!-- @Author: Yu_Bo -->
<template>
	<view class="bright">
		<view class="bright_tab">
			<u-tabs :list="navList" :is-scroll="false" :current="current" @change="change"></u-tabs>
		</view>
		<!--  -->
		<view class="bright_list">
			<view class="list" v-for="(item,index) in list" :key="index">
				<view class="left">
					<view class="title">
						申请提现
					</view>
					<view class="time">
						{{item.createtime}}
					</view>
					<view class="txt" v-if="current == 2">
						{{item.refusal_reason}}
					</view>
				</view>
				<view class="right color_a">
					-{{item.money}}
				</view>
			</view>
		</view>
		<view class="mall_loading" v-if="list.length">
			<u-loadmore :status="status" color='#999' font-size='26' />
		</view>
		<!-- 无数据 -->
		<c-emptydata :type="3" v-if="list.length == 0"></c-emptydata>
	</view>
</template>

<script>
	export default {
		components: {},
		data() {
			return{
				navList: [
					{name: '待审核'},
					{name: '已提现'},
					{name: '已拒绝'},
				],
				current: 0,
				list: [],
				page: 1,
				status: 'loadmore',//加载前值为loadmore，加载中为loading，没有数据为nomore
			}
		},
		computed: {},
		onLoad() {
			this.getList()
		},
		onShow() {},
		methods: {
			// 切换
			change(index) {
				this.current = index
				this.page = 1
				this.getList()
			},
			// 列表
			getList() {
				var that = this
				if(that.pages != 1) {
					that.status = 'loading'
				}
				var params = {
					page: that.page,
					status: that.current
				}
				that.$httpApi.withdrawLog(params).then((res) => {
					if (res.code == 1) {
						if(that.page == 1) {
							that.list = []
						}
						if(res.data && res.data.length == 10) {
							that.list=that.list.concat(res.data)
							that.status = "loadmore"
						} else if(res.data && res.data.length < 10) {
							that.list=that.list.concat(res.data)
							that.status = "nomore"
						} else {
							that.status = "nomore"
						}
					}
				})
			},
		},
		onReachBottom(){
			 if(this.status == 'nomore' || this.status == 'loading'){
			 	return
			 }
			 this.page++
			 this.search()
		}
	}
</script>

<style lang='scss' scoped>
	.bright_tab {
		position: fixed;
		top: 0;
		left: 0;
		z-index: 1;
		width: 100%;
		height: 100rpx;
		background: #ffffff;
	}
	
	.bright_list {
		width: 100%;
		padding: 100rpx 30rpx 0;
		
		.list {
			width: 100%;
			padding: 30rpx 0;
			border-bottom: 2rpx solid rgba(34, 34, 34, 0.05);
			display: flex;
			align-items: center;
			justify-content: space-between;
			
			.left {
				
				.title {
					font-family: PingFang SC, PingFang SC;
					font-weight: 500;
					font-size: 28rpx;
					color: #222222;
				}
				
				.time {
					padding-top: 8rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #999999;
				}
				
				.txt {
					padding-top: 8rpx;
					font-family: PingFang SC, PingFang SC;
					font-weight: 400;
					font-size: 24rpx;
					color: #FF3E3E;
				}
			}
			
			.right {
				font-family: PingFang SC, PingFang SC;
				font-weight: 600;
				font-size: 32rpx;
			}
			
			.color_a {
				color: #FE4949;
			}
			
			.color_b {
				color: #67C23A;
			}
		}
	}
</style>